//
//  WishListTableViewCell.m
//  Memo
//
//  Created by A-01 on 2020/7/8.
//  Copyright © 2020 A-01. All rights reserved.
//

#import "WishListTableViewCell.h"

@implementation WishListTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self setupUI];
    }
    
    return self;
}


- (void)setupUI{

    self.selectionStyle = UITableViewCellSelectionStyleNone;
    self.backgroundColor = [UIColor clearColor];
    
    UIImageView * backImageView = [UIImageView new];
    
    backImageView.image = [UIImage imageNamed:@"矩形"];
    
    self.backImageView = backImageView;
    
    [self.contentView addSubview:self.backImageView];
    
    
    UILabel * titleLabel = [UILabel new];
    
    titleLabel.text = @"Eat";
    titleLabel.textColor = ZRBlackColor;
    titleLabel.font = [UIFont systemFontOfSize:20];
    
    self.titleLabel = titleLabel;
    
    [self.backImageView addSubview:self.titleLabel];
    
    
    UIImageView * rightImageView = [UIImageView new];
    
    rightImageView.image = [UIImage imageNamed:@"right"];
    
    self.rightImageView = rightImageView;
    
    [self.contentView addSubview:self.rightImageView];
    
    
    UIImageView * statusImageView = [UIImageView new];
    
    statusImageView.image = [UIImage imageNamed:@"processing"];
    statusImageView.contentMode = UIViewContentModeScaleAspectFit;
    
    self.statusImageView = statusImageView;
    
    [self.contentView addSubview:self.statusImageView];
}


-(void)layoutSubviews{
    
    [self.backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(self.contentView).offset(15);
        make.trailing.mas_equalTo(self.contentView).offset(-15);
        make.centerY.mas_equalTo(self.contentView);
        make.height.mas_equalTo(65);
    }];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.backImageView);
        make.leading.mas_equalTo(self.backImageView).offset(15);
    }];
    
    [self.rightImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.backImageView);
        make.trailing.mas_equalTo(self.backImageView).offset(-15);
        make.width.mas_equalTo(8);
        make.height.mas_equalTo(14);
    }];
    
    [self.statusImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.backImageView);
        make.trailing.mas_equalTo(self.rightImageView.mas_leading).offset(-20);
    }];
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
